static char *opt_trackdata = NULL;
static char *opt_units = NULL;
static char *opt_labels = NULL;
+static char *opt_max_position_points = NULL;
static int export_lines;
static int export_points;
static int floating;
static int extrude;
static int trackdata;
+static int posn_track_points;
+static int max_position_points;
static int indent_level;
{"labels", &opt_labels,
"Display labels on track and routepoints (default = 1)",
"1", ARGTYPE_BOOL, ARG_NOMINMAX },
+ {"max_position_points", &opt_max_position_points,
+ "Retain at most this number of position points (0 = unlimited)",
+ "0", ARGTYPE_INT, ARG_NOMINMAX },
ARG_TERMINATOR
};
posnfilename = fname;;
posnfilenametmp = xstrappend(xstrdup(fname), "-");
realtime_positioning = 1;
+
/*
* 30% of our output file is whitespace. Since parse time
* matters in this mode, turn the pretty formatting off.
*/
do_indentation = 0;
- kml_wr_init(fname);
+ kml_wr_init(posnfilenametmp);
+
+ max_position_points = atoi(opt_max_position_points);
}
static void
track_add_head(trk_head);
}
+ if (max_position_points && (posn_track_points >= max_position_points)) {
+ waypoint *tonuke = QUEUE_FIRST(&trk_head->waypoint_list);
+ dequeue(&tonuke->Q);
+ waypt_free(tonuke);
+ }
+
track_add_wpt(trk_head, t);
+ posn_track_points++;
waypt_add(wpt);
kml_write();